package com.laihui.adapters;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;


import com.laihui.activity.R;
import com.laihui.entity.RedPacketList;
import com.laihui.model.DiscountCoupon;
import com.laihui.model.RedBean;
import com.laihui.utils.YXDate;
import com.laihui.viewholder.TobeUseViewHolder;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;

/**
 * Created by ST on 2017/7/24.
 */

public class RedAdapter extends RecyclerArrayAdapter<RedPacketList.RedPacket>{
    public RedAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new RedViewHolder(parent);
    }
    public class RedViewHolder extends BaseViewHolder<RedPacketList.RedPacket> {
        private TextView tv_type, tv_limit_day, tv_activity, tv_activity_suffix, tv_money,tv_way;
        private LinearLayout ll_background;

        public  RedViewHolder(
        ViewGroup parent)

        {
            super(parent, R.layout.item_tobe_use_blue);
            tv_activity = $(R.id.tv_activity);
            tv_type = $(R.id.tv_type);
            tv_activity_suffix = $(R.id.tv_activity_suffix);
            tv_money = $(R.id.tv_money);
            tv_limit_day = $(R.id.tv_limit_day);
            ll_background = $(R.id.ll_background);
            tv_way =  $(R.id.tv_way);
        }

        @Override
        public void setData(RedPacketList.RedPacket data) {
            super.setData(data);
            tv_limit_day.setText("有效期: " + YXDate.TimeStamp2DateTimeYear(data.addtime) + "-" +  YXDate.TimeStamp2DateTimeYear(data.over_time));
                    ll_background.setBackgroundResource(R.mipmap.icon_blue);
                    tv_type.setText("抵扣券");
                    tv_money.setText("满: " + data.tender_limit + "元可用");
                    tv_activity.setText(data.money+"元");
                    tv_activity_suffix.setText("元");
                    tv_way.setText("限"+data.tender_time_limit+"月以上标种");

        }

    }
}
